package visualizer.client.widgets.tree;

import com.google.gwt.user.client.ui.Widget;
import visualizer.client.bst.BinaryTree;

/**
 * User: DDovzhenko
 * Date: 28.12.13
 * Time: 14:37
 */
public class TreePresenter {

    private Display view;

    public TreePresenter(Display view) {
        this.view = view;
    }

    public Widget getWidget() {
        return view.asWidget();
    }

    public void setModel(BinaryTree tree) {
        view.setNewTree(tree);
    }

    public void updateModel(BinaryTree tree) {
        view.updateTree(tree);
    }

    public void onResize() {
        view.onResize();
    }

    interface Display {
        Widget asWidget();
        void setNewTree(BinaryTree tree);
        void updateTree(BinaryTree tree);
        void onResize();
    }
}
